//引入公共函数模块
let util = require('../../utils/util');

let printer = require('../../utils/printer');

Page({

  data: {
  
  },

  onLoad: function (options) {
      
  },

  onShow: function() {
      printer.init({
          //蓝牙打开事件
          bluetoothOpen: function() {
            
          },
          //蓝牙关闭事件
          bluetoothClose: function() {
          
          },
          //蓝牙开始搜索事件
          bluetoothStartScan: function() {
              
          },
          //蓝牙停止搜索事件
          bluetoothStopScan: function() {

          },
          //寻找到打印机设备事件
          printerFound: function(devices) {
              printer.connect({
                  deviceId: devices[0].deviceId,
                  connectSuccess: function(deviceId) {
                    console.log(deviceId);
                  },
                  connectFail: function() {

                  }
              });
          },
          //打印机设备连接成功事件
          printerConnected: function() {

          },
          //打印机设备断开连接事件
          printerDisconnected: function() {

          }
      });
      printer.open({
          unSupport: function() {

          },
          notOpenBluetooth: function() {

          },
          startFindFail: function() {

          },
          stopFindFail: function() {

          },
          openSuccess: function() {

          },
          failSuccess: function() {

          }
      });
  }

})